﻿<HTML>
<HEAD>
<TITLE>Calendar</TITLE>
<style type=text/css>
.date{
	FONT-WEIGHT: normal; FONT-SIZE: 7pt; FONT-FAMILY: 'verdana'; COLOR:#333333
}
.normal_uni{
	FONT-WEIGHT: normal; FONT-SIZE: 10pt; FONT-FAMILY: 'arial'; TEXT-ALIGN:'left';
}
.cbobox_uni{
	FONT-WEIGHT: normal; FONT-SIZE: 10pt; FONT-FAMILY: 'arial'; background-color:#FFFFF2
}
</style>
 
<STYLE TYPE="text/css">
	.today {color:red; font-weight:bold;font-size:13px;font-face:sans serif;text-decoration:underline;}
	.days {font-weight:bold}
	.allday{font-face:sans serif,arial;font-size:13px;text-decoration:underline;}
</STYLE>
      <SCRIPT LANGUAGE="JavaScript">
         // Initialize arrays.
         var months = new Array("Th&aacute;ng 1", "Th&aacute;ng 2", "Th&aacute;ng 3", "Th&aacute;ng 4", "Th&aacute;ng 5", "Th&aacute;ng 6", "Th&aacute;ng 7", "Th&aacute;ng 8", "Th&aacute;ng 9", "Th&aacute;ng 10", "Th&aacute;ng 11", "Th&aacute;ng 12");
         var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,
            30, 31, 30, 31);
         var days = new Array("CN", "Hai", "Ba", "T&#432;",
            "N&#259;m", "S&aacute;u", "B&#7843;y");

         function getDays(month, year) {
            // Test for leap year when February is selected.
            if (1 == month)
               return ((0 == year % 4) && (0 != (year % 100))) ||
                  (0 == year % 400) ? 29 : 28;
            else
               return daysInMonth[month];
         }

         function getToday() {
            // Generate today's date.
            this.now = new Date();
            this.year = this.now.getFullYear();
            this.month = this.now.getMonth();
            this.day = this.now.getDate();
         }

         // Start with a calendar for today.
         today = new getToday();

         function newCalendar() {
            today = new getToday();
            var parseYear = parseInt(document.all.year
               [document.all.year.selectedIndex].text);
            var newCal = new Date(parseYear,
               document.all.month.selectedIndex, 1);
            var day = -1;
            var startDay = newCal.getDay();
            var daily = 0;
            if ((today.year == newCal.getFullYear()) &&
                  (today.month == newCal.getMonth()))
               day = today.day;
            // Cache the calendar table's tBody section, dayList.
            var tableCal = document.all.calendar.tBodies.dayList;
            var intDaysInMonth =
               getDays(newCal.getMonth(), newCal.getFullYear());
            for (var intWeek = 0; intWeek < tableCal.rows.length;
                  intWeek++)
               for (var intDay = 0;
                     intDay < tableCal.rows[intWeek].cells.length;
                     intDay++) {
                  var cell = tableCal.rows[intWeek].cells[intDay];

                  // Start counting days.
                  if ((intDay == startDay) && (0 == daily))
                     daily = 1;

                  // Highlight the current day.
                  cell.className = (day == daily) ? "today" : "allday";

                  // Output the day number into the cell.
                  if ((daily > 0) && (daily <= intDaysInMonth))
                     cell.innerText = daily++;
                  else
                     cell.innerText = "";
               }
         }

         function getDate() {
		 	var sDate;
            // This code executes when the user clicks on a day
            // in the calendar.
            if ("TD" == event.srcElement.tagName)
               // Test whether day is valid.
               if ("" != event.srcElement.innerText)
                  //alert(event.srcElement.innerText);
				  sDate = event.srcElement.innerText + "/" + document.all.month.value + "/" + document.all.year.value;
				  document.all.ret.value = sDate;
 		  		  window.close();
         }
      </SCRIPT>
</HEAD>

<BODY bgcolor="#6699cc" ONLOAD="newCalendar()" OnUnload="window.returnValue = document.all.ret.value;">
<INPUT type="hidden" name="ret"> 

<FORM method="POST" action="calendar.asp" > 

<TABLE cellpadding="0" cellspacing="0" bgcolor=#6699cc height=170>
  <TR>
    <TD>
	  <!---------------- Table border of Calendar -------------->
	  <table border="0" cellpadding="0" cellspacing="0">
	    <tr>
		  <td colspan=7><img src="spacer.gif" width="10" height="4"></td>
		</tr>
		<tr height=30><!------------ TR Months and years --------------->
		  <td rowspan="3"><img src="spacer.gif" width="10" height="102"></td>
		  <td align="left" valign="top" bgcolor="#CCCC99"><img src="corner_calendar_tl.gif" width="8" height="15"></td>
		  <td colspan="3" bgcolor="#CCCC99" align="center" valign=middle>
                  <!-- Month combo box -->
                  <SELECT ID="month" ONCHANGE="newCalendar()" class=cbobox_uni>
					 <SCRIPT LANGUAGE="JavaScript">
                        // Output months into the document.
                        // Select current month.
                        for (var intLoop = 0; intLoop < months.length;
                              intLoop++)
                           document.write("<OPTION VALUE= " + (intLoop + 1) + " " +
                              (today.month == intLoop ?
                                 "Selected" : "") + ">" +
                              months[intLoop]);
                     </SCRIPT>
                  </SELECT>
					&nbsp;&nbsp;
                  <!-- Year combo box -->
               	
			    <SELECT ID="year" ONCHANGE="newCalendar()" class=cbobox_uni>
                     <SCRIPT LANGUAGE="JavaScript">
                        // Output years into the document.
                        // Select current year.
						for (var intLoop = 1900; intLoop < (today.year + 29);
                              intLoop++)
                           document.write("<OPTION VALUE= " + intLoop + " " +
                              (today.year == intLoop ?
                                 "Selected" : "") + ">" +
                              intLoop);
                     </SCRIPT>
              </SELECT>
		  </td>
		  <td align="right" valign="top" bgcolor="#CCCC99"><img src="corner_calendar_tr.gif" width="8" height="15"></td>
		  <td rowspan="3"><img src="spacer.gif" width="10" height="102"></td>
		</tr><!------------ END Months and years --------------->
		<tr><!------------ Days --------------->
		  <td bgcolor="#FFFFF2"><img src="spacer.gif" width="8" height="95" border="0"></td>
		  <td colspan="3" bgcolor="#FFFFFF" align="center">
			  <TABLE ID="calendar" cellpadding="2" cellspacing="0" bgcolor="#FFFFF2" border=0>
				 <THEAD>
					<TR CLASS="days" bgcolor="">
					   <!-- Generate column for each day. -->
					   <SCRIPT LANGUAGE="JavaScript">
						  // Output days.
						  for (var intLoop = 0; intLoop < days.length; intLoop++)
						  {	
							 if (intLoop == 0)
								document.write("<TD width='30' align='center' style='color:#CC0000' class=normal_uni>" + days[intLoop] + "</TD>");
							 else if (intLoop == 6)
								document.write("<TD width='30' align='center' style='color:#0000CC' class=normal_uni>" + days[intLoop] + "</TD>");
							 else 
								document.write("<TD width='30' align='center' style='color:#000033' class=normal_uni>" + days[intLoop] + "</TD>");
						  }	 
					   </SCRIPT>
					</TR>
				 </THEAD>
				 <TBODY ID="dayList" ALIGN=CENTER ONCLICK="getDate()" bgcolor=""  class=normal_uni>
					<!-- Generate grid for individual days. -->
					<SCRIPT LANGUAGE="JavaScript">
					   for (var intWeeks = 0; intWeeks < 6; intWeeks++) 
					   {
						  document.write("<TR>");
						  for (var intDays = 0; intDays < days.length;intDays++)
							 document.write("<TD align=center style='font-size:9pt;color:#000066'></TD>");
						  document.write("</TR>");
					   }
					</SCRIPT>
				 </TBODY>
			  </TABLE>
		  </td>
		  <td bgcolor="#FFFFF2"><img src="spacer.gif" width="8" height="79"></td>
		</tr>

		<tr height=25>
		  <td align="left" valign="bottom" bgcolor="#CCCC99"><img src="corner_calendar_bl.gif" width="8" height="8"></td>
		  <td colspan="3" bgcolor="#CCCC99" align=center valign=middle><img src="b2_return_win.gif" onClick="window.close();"></td>
		  <td align="right" valign="bottom" bgcolor="#CCCC99"><img src="corner_calendar_br.gif" width="8" height="8"></td>
		</tr>
	</table>
	</TD>
  </TR>
</TABLE>
</FORM>
</BODY>

<Script Language="JavaScript1.2">
	function Cancel() {
		document.all.ret.value = "";
		window.close();
	}
</script>
